# -*- coding:utf-8 -*-
# @Author: shenyuyu
# @Time: 2023/6/26 11:23
# @File: qu_7_foreach.py
from pyspark import SparkConf, SparkContext
from operator import add

if __name__ == '__main__':
    conf = SparkConf().setAppName("test").setMaster("local[*]")
    sc = SparkContext(conf=conf)

    rdd = sc.parallelize([1, 2, 3, 4, 5, 6])

    # 没有返回值,也不会影响数据本身，这个算子是有executor之间运行
    rdd.foreach(lambda x: print(x * 10))
    print(rdd.collect())